<?php
class Custom_Controller_Plugin_View extends Zend_Controller_Plugin_Abstract
{
    public function routeShutdown(Zend_Controller_Request_Abstract $request)
    {
        $module = $request->getModuleName();

        $bootstrap = Zend_Controller_Front::getInstance()->getParam('bootstrap');

        $bootstrap->bootstrap('View');
        $view = $bootstrap->getResource('View');
        $moduleParams = $view->$module;

        //set module base path and helper
        $view->addBasePath($moduleParams['basePath'])
             ->addHelperPath($moduleParams['helperPath'],
                             $moduleParams['helperPathPrefix']);
        //set layout
        $bootstrap->bootstrap('Layout');
        $layout = $bootstrap->getResource('Layout');
        $layout->setLayoutPath($moduleParams['layoutPath'])
               ->setLayout($moduleParams['layout']);

        // set the content type and language
        $view->headMeta()->appendHttpEquiv('Content-Type', 'text/html; charset='.$view->charSet);
        $view->headLink(Array('rel' => 'icon', 'href' => $view->baseUrl().'/favicon.ico', 'type' => 'image/x-icon'));
        $view->headLink(Array('rel' => 'shortcut icon', 'href' => $view->baseUrl().'/favicon.ico', 'type' => 'image/x-icon'));

        //add stylesheets
        $view->addStylesheet('main.css','first');

        //add javascripts
        $view->addJavascript('jquery/jquery.min.js','first');
        $view->addJavascript('wenda/common.js');
        
        // setting the site in the title
        $view->headTitle('Power by Wenda!');

        // setting a separator string for segments:
        $view->headTitle()->setSeparator(' - ');
    }
}